#!/usr/bin/env ruby

keys = {
  'LAT.secs_latency' => 'secs,\s*NUMA-convergence-latency',
  'LAT.secs_slowest' => 'secs,\s*runtime-max/thread',
  'LAT.secs_fastest' => 'secs,\s*runtime-min/thread',
  'LAT.secs_avg' => 'secs,\s*runtime-avg/thread',
  'JIT.max_avg_diff' => '%,\s*spread-runtime/thread',
  'GAUGE.GB_per_thread' => 'GB,\s*data/thread',
  'GAUGE.GB_total' => 'GB,\s*data-total',
  'LAT.nsecs_byte_thread' => 'nsecs,\s*runtime/byte/thread',
  'RATE.GB/sec_thread' => 'GB/sec,\s*thread-speed',
  'RATE.GB/sec_total' => 'GB/sec,\s*total-speed'
}

while (line = $stdin.gets)
  keys.each do |k, v|
    puts "#{k}: #{$1}" if line =~ /([\d.]+),\s*#{v}/
  end
end
